@extends('home/layout/index')

@section('content')

<div class="user-address">
	<!--标题 -->
	<div class="am-cf am-padding">
		<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">地址管理</strong> / <small>Address&nbsp;list</small></div>
		
	</div>
	<hr/>
	<ul class="am-avg-sm-1 am-avg-md-3 am-thumbnails">
		@foreach($data as $k => $v)
		<li  @if($data1['id'] == $v['id']) class="user-addresslist defaultAddr" @else class="user-addresslist" @endif>
			<span class="new-option-r" aid="{{$v['id']}}"><i class="am-icon-check-circle"></i>默认地址</span>
			<p class="new-tit new-p-re">
				<span class="new-txt">{{ $v['name'] }}</span>
				<span class="new-txt-rd2">{{ $v['tel'] }}</span>
			</p>
			<div class="new-mu_l2a new-p-re">
				<p class="new-mu_l2cw">
					<span class="title">地址：</span>
					<span class="province">{{ $v['province'] }}</span>省
					<span class="city">{{ $v['country'] }}</span>市
					<span class="dist">{{ $v['town'] }}</span>区
					<span class="street">{{ $v['adress'] }}</span></p>
			</div>
			<div class="new-addr-btn">
				<a href="/home/user/adressedit/{{ $v['id'] }}"><i class="am-icon-edit"></i>编辑</a>
				<span class="new-addr-bar">|</span>
				<a href="/home/user/adressdelete/{{ $v['id'] }}" onClick="return confirm('确认要删除吗?');delClick(this);"><i class="am-icon-trash"></i>删除</a>
			</div>
		</li>
		
		@endforeach
		
		
	</ul>
	<div class="clear"></div>
	<a class="new-abtn-type" data-am-modal="{target: '#doc-modal-1', closeViaDimmer: 0}">添加新地址</a>
	<!--例子-->
	<div class="am-modal am-modal-no-btn" id="doc-modal-1">

		<div class="add-dress">

			<!--标题 -->
			<div class="am-cf am-padding">
				<div class="am-fl am-cf"><strong class="am-text-danger am-text-lg">新增地址</strong> / <small>Add&nbsp;address</small></div>
			</div>
			<hr/>

			<div class="am-u-md-12 am-u-lg-8" style="margin-top: 20px;">



				<form class="am-form am-form-horizontal" method="post" action="/home/user/adressadd">
					{{ csrf_field() }}
					<div class="am-form-group">
						<label for="user-name" class="am-form-label">收货人</label>
						<div class="am-form-content">
							<input type="text" id="user-name" placeholder="收货人" name="name" value="">
						</div>
					</div>

					<div class="am-form-group">
						<label for="user-phone" class="am-form-label">手机号码</label>
						<div class="am-form-content">
							<input id="user-phone" placeholder="手机号必填" type="tel" name="tel" value="">
						</div>
					</div>
					 <div class="am-form-group">
						<label for="user-address" class="am-form-label">所在地</label>
						<div class="am-form-content address">
							@include('/home/user/area/index')
						</div>
					</div> 
					<div class="am-form-group">
						<label for="user-intro" class="am-form-label">详细地址</label>
						<div class="am-form-content">
							<textarea class="" rows="3" id="user-intro" placeholder="输入详细地址" name="adress" value=""></textarea>
							<small>100字以内写出你的详细地址...</small>
						</div>
					</div><br>
					
					<div class="am-form-group">
						<div class="am-u-sm-9 am-u-sm-push-3">
							
							<input type="image" src="/homes/images/button_save.gif">
							<a href=""><img src="/homes/images/button_reset.gif" alt="" style="position:absolute;margin-left:20px;"></a>
							
						</div>
					</div>
				</form>
			</div>

		</div>

	</div>

</div>
<script type="text/javascript">

/*	$(document).ready(function() {							
		$(".new-option-r").click(function() {
			$(this).parent('.user-addresslist').addClass("defaultAddr").siblings().removeClass("defaultAddr");	
		});
		
		var $ww = $(window).width();
		if($ww>640) {
			$("#doc-modal-1").removeClass("am-modal am-modal-no-btn")
		}
		
	})
*/

$(document).ready(function() {							
		$(".new-option-r").click(function() {
			var l = $(this).attr('aid');
			//alert(l);
			$(this).parent('.user-addresslist').addClass("defaultAddr").siblings().removeClass("defaultAddr");
			$.get('/home/user/ajax?id='+l,function(str){
				
			});
		});
		
		/*$(".new-option-r").click(function() {
			$(this).parent('.user-addresslist').addClass("defaultAddr").siblings().removeClass("defaultAddr");	
		});*/
		
		var $ww = $(window).width();
		if($ww>640) {
			$("#doc-modal-1").removeClass("am-modal am-modal-no-btn")
		}
		var $ww = $(window).width();
		if($ww>640) {
			$("#doc-modal-1").removeClass("am-modal am-modal-no-btn")
		}
		
	})
	/*$.ajax({
				type:'POST';
				url:'/home/user/ajaxadress';
				data:"id = 1 ";
				success:function(str){
					alert(str);
				}
				
			});*/
</script>
<div class="clear"></div>
@endsection